package org.dromara.bean.config;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.bean.constant.WXPayConstants;
import org.dromara.bean.util.wxApi.IWXPayDomain;

import java.io.InputStream;

@Data
@EqualsAndHashCode(callSuper = false)
public class WxPaymentConfig extends WXPayConfig {

    /**
     * 配置日志路径
     */
    private String logFilePath;

    /**
     * 授权证书key
     */
    private String certKey;

    /**
     * 证书
     */
    private String sslCert;

    /**
     * 授权证书cert
     */
    private String certClient;

    /**
     * 微信回调地址
     */
    private String notifyUrl;

    /**
     * 支付秘钥
     */
    private String payKey;

    /**
     * 商户号
     */
    private String mchId;

    /**
     * 关联的app秘钥
     */
    private String appSecret;

    /**
     * 关联的app id--可以是小程序，开放平台
     */
    private String appId;

    private String mchSerialNo;

    private String apiV3Key;

    private String refundUrl;

    private String refundNotifyUrl;

    private String mchName;


    @Override
    public String getMchID() {
        return mchId;
    }

    @Override
    public String getKey() {
        return payKey;
    }

    @Override
    public InputStream getCertStream() {
        return null;
    }

    @Override
    public IWXPayDomain getWXPayDomain() {
        IWXPayDomain iwxPayDomain = new IWXPayDomain() {
            @Override
            public void report(String domain, long elapsedTimeMillis, Exception ex) {
            }

            @Override
            public DomainInfo getDomain(WXPayConfig config) {
                return new DomainInfo(WXPayConstants.DOMAIN_API, true);
            }
        };
        return iwxPayDomain;
    }
}
